package com.cloud.mall.usr.service;

import com.cloud.mall.api.CommonPage;
import com.cloud.mall.base.BaseResponse;
import com.cloud.mall.user.dto.UmsMenuNode;
import com.cloud.mall.user.input.UmsMenuInpDTO;
import com.cloud.mall.user.output.UmsMenuOut;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "菜单接口")
@RequestMapping("/menu")
public interface UmsMenuService {

    @ApiOperation(value = "添加后台菜单")
    @PostMapping("/create")
    BaseResponse create(@RequestBody UmsMenuInpDTO menuInpDTO);

    @ApiOperation("修改后台菜单")
    @PostMapping("/update/{id}")
    BaseResponse update(@PathVariable Long id, @RequestBody UmsMenuInpDTO menuInpDTO);

    @ApiOperation("根据ID删除后台菜单")
    @PostMapping("/delete/{id}")
    BaseResponse delete(@PathVariable Long id);

    @ApiOperation("树形结构返回所有菜单列表")
    @GetMapping("/treeList")
    BaseResponse<List<UmsMenuNode>>  treeList();

    @ApiOperation("根据ID获取菜单详情")
    @GetMapping("/{id}")
    BaseResponse<UmsMenuOut>  getItem(@PathVariable Long id);

    @ApiOperation("分页查询后台菜单")
    @GetMapping("/list/{parentId}")
    BaseResponse<CommonPage<UmsMenuOut>> list(@PathVariable Long parentId,
                                           @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                           @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum);

    @ApiOperation("修改菜单显示状态")
    @PostMapping("/updateHidden/{id}")
    BaseResponse updateHidden(@PathVariable Long id, @RequestParam("hidden") Integer hidden);
}
